/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package factories;


import strategies.GroupCreationStrategy;
import strategies.RelationshipStatusCreationStrategy;
import strategies.RelatedCreationStrategy;
import strategies.PersonCreationStrategy;
import entityclasses.Group;
import entityclasses.RelationshipStatus;
import entityclasses.Related;
import entityclasses.Person;
import socialappexception.UnknownTypeException;
import java.util.Vector;
import javax.swing.JOptionPane;


/**
 *
 * @author YCAN
 */
public class VectorFactory {
    public static Vector createVector(Object type)
    {
        try
        {
            if(type.equals(Person.class))
            {
                PersonCreationStrategy pcs = new PersonCreationStrategy();
                return pcs.createVector();
            }
            else if(type.equals(Group.class))
            {
                GroupCreationStrategy gcs = new GroupCreationStrategy();
                return gcs.createVector();
            }
            else if(type.equals(RelationshipStatus.class))
            {
                RelationshipStatusCreationStrategy rscs = new RelationshipStatusCreationStrategy();
                return rscs.createVector();
            }
            else if(type.equals(Related.class))
            {
                RelatedCreationStrategy rcs = new RelatedCreationStrategy();
                return rcs.createVector();
            }
            else 
            {
                throw new UnknownTypeException("Bilinmeyen sinif tipi.");
            }
        }
        catch(UnknownTypeException ute)
        {
            JOptionPane.showMessageDialog(null, ute.getMessage(),"Hata", JOptionPane.ERROR_MESSAGE);
            return null;
        }
        
    }
}
